package com.gxuwz.eschool;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.ListView;
import android.widget.SimpleAdapter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class PayRecordActivity extends AppCompatActivity {
    ListView lv;
    SimpleAdapter simpleAdapter;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_pay_record);

        lv = findViewById(R.id.pay_record_list);
        simpleAdapter = new SimpleAdapter(
                PayRecordActivity.this,this.getData(),R.layout.pay_record_list_item,
                new String[]{"pic","place","id","time","money","from"},
                new int[]{R.id.pay_record_item_pic,R.id.pay_record_item_place,R.id.pay_record_item_id,R.id.pay_record_item_time,R.id.pay_record_item_money,R.id.pay_record_item_money_from}

        );
        lv.setAdapter(simpleAdapter);
    }





    public void goBack(View v){
        this.finish();
    }
    private List<Map<String,Object>> getData() {
        String[] places = {"第三食堂二楼食堂"};
        int[] pics = {R.drawable.noddles};
        String[] money = {"-11"};
        String[] ids = {"交易流水号:1231231"};
        String[] froms = {"商务收费"};
        String[] times = {"交易时间:12-08 12:11:14"};
        List<Map<String, Object>> list = new ArrayList<>();
        for (int i = 0; i < 1; i++) {
            Map map = new HashMap();
            map.put("money",money[i]);
            map.put("id",ids[i]);
            map.put("pic",pics[i]);
            map.put("place", places[i]);
            map.put("time", times[i]);
            map.put("from", froms[i]);
            list.add(map);
        }
        return list;

    }

}